package com.change.study.data.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.openyelp.annotation.NoGson;

@Entity
@Table(name = "posts")
public class Posts implements Serializable {

	public static final int A = 2;

	public static final int A_HIDDEN = 5;

	public static final int A_QUEUED = 8;

	public static final int C = 3;
	public static final int C_HIDDEN = 6;

	public static final int C_QUEUED = 9;
	public static final int NOTE = 10;
	public static final int Q = 1;
	public static final int Q_HIDDEN = 4;
	public static final int Q_QUEUED = 7;
	private Long addDate;
	@NoGson
	@ManyToOne
	private PostsCatalog catalog;
	/**
	 * 提问回复个人
	 */
	private Integer commentsize;
	private String content;
	private Integer downvotes;

	/**
	 * 举报次数
	 */
	private Integer flagcount;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	private Long lastDate;

	private String name;
    private Integer netvotes;
    private String notify;
	
	/**
	 * 父id
	 */
	private Long parentid;

	/**
	 * 标签
	 */
	private String tag;

	@NoGson
	@JoinTable(name = "posts_link_tag")
	@ManyToMany()
	private List<PostsTag> tags;

	private String title;

	/**
	 * 'Q','A','C',
	 * 'Q_HIDDEN','A_HIDDEN','C_HIDDEN','Q_QUEUED','A_QUEUED','C_QUEUED','NOTE'
	 * 1 提问 2 回答 3 评论 4 回答隐藏 5评论隐藏 6回答隐藏 7提问举报 8回答举报 9评论举报 10 笔记
	 * 
	 */
	private Integer type;

	private Integer upvotes;

	@ManyToOne
	private User user;

	private Integer views;

	public Long getAddDate() {
		return addDate;
	}
	public PostsCatalog getCatalog() {
		return catalog;
	}

	public Integer getCommentsize() {
		return commentsize;
	}

	public String getContent() {
		return content;
	}

	public Integer getDownvotes() {
		return downvotes;
	}

	public Integer getFlagcount() {
		return flagcount;
	}

	public Long getId() {
		return id;
	}

	public Long getLastDate() {
		return lastDate;
	}

	public String getName() {
		return name;
	}

	public Integer getNetvotes() {
		return netvotes;
	}

	public String getNotify() {
		return notify;
	}

	public Long getParentid() {
		return parentid;
	}

	public String getTag() {
		return tag;
	}

	public List<PostsTag> getTags() {
		return tags;
	}

	public String getTitle() {
		return title;
	}

	public Integer getType() {
		return type;
	}

	public Integer getUpvotes() {
		return upvotes;
	}

	public User getUser() {
		return user;
	}

	public Integer getViews() {
		return views;
	}

	public void setAddDate(Long addDate) {
		this.addDate = addDate;
	}

	public void setCatalog(PostsCatalog catalog) {
		this.catalog = catalog;
	}

	public void setCommentsize(Integer commentsize) {
		this.commentsize = commentsize;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setDownvotes(Integer downvotes) {
		this.downvotes = downvotes;
	}

	public void setFlagcount(Integer flagcount) {
		this.flagcount = flagcount;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setLastDate(Long lastDate) {
		this.lastDate = lastDate;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setNetvotes(Integer netvotes) {
		this.netvotes = netvotes;
	}

	public void setNotify(String notify) {
		this.notify = notify;
	}

	public void setParentid(Long parentid) {
		this.parentid = parentid;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public void setTags(List<PostsTag> tags) {
		this.tags = tags;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public void setUpvotes(Integer upvotes) {
		this.upvotes = upvotes;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public void setViews(Integer views) {
		this.views = views;
	}

}
